//
//  GoodsStyleCell.m
//  体育商城
//
//  Created by  on 2022/9/23.
//

#import "GoodsStyleCell.h"
@interface GoodsStyleCell()
@property (strong, nonatomic) IBOutlet UIImageView *img;
@property (strong, nonatomic) IBOutlet UILabel *title;
@property (strong, nonatomic) NSURLSessionTask *task;
@end
@implementation GoodsStyleCell
- (void)awakeFromNib{
    [super awakeFromNib];
}

- (void)setModel:(Goods *)model{
    if (_model != model) {
        if (self.task) {
            [self.task cancel];
        }
        self.img.image = nil;
        self.title.text = [NSString stringWithFormat:@"%@: %@ %@",LS(@"规格尺寸"),model.colour,model.sortOrder];
        self.task = [UIImage imageWithURL:model.mainImage block:^(UIImage * _Nonnull image) {
            self.img.image = image;
        }];
    }
}
@end
